package com.swiftride.controller.app;

import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import com.swiftride.pojo.domain.DriverSummary;
import com.swiftride.pojo.dto.DriverSummaryTodayDto;
import com.swiftride.result.R;
import com.swiftride.service.IDriverSummaryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "司机结算对象", description = "司机结算对象")
@RestController
@RequestMapping("/app/summary")
public class AppDriverSummaryController {

    @Autowired
    private IDriverSummaryService driverSummaryService;

    @Operation(summary = "司机今日统计信息获取", description = "司机今日统计信息获取接口")
    @GetMapping
    public R<DriverSummaryTodayDto> get() {
        DriverSummary driverSummary = driverSummaryService.getById(StpUtil.getLoginIdAsLong());
        return R.success(BeanUtil.copyProperties(driverSummary, DriverSummaryTodayDto.class));
    }
}
